package com.woniu.rabbitMq.schedul;

import com.woniu.rabbitMq.service.FailMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时器
 * @author Administrator
 */
@Component
@Slf4j
public class SendMsgSchedul {
    @Autowired
    private FailMessageService failMessageService;

    /**
     * cron表达式：秒 分 时 日 月 周
     * //@Scheduled(cron = "* * * * * *")
     * fixedDelay：上一次执行完毕时间点之后10秒再执行
     */
    @Scheduled(fixedDelay = 10000)
    public void sendMsg() {
        log.info("sendMsg begin");
        failMessageService.sendMsg();
        log.info("sendMsg end");
    }
}
